const mixin = {
  methods: {
    handlerXHR(data, cb, cb_fail) {
      if (data.data.code == 'SUCCESS') {
        cb(data)
      } else if (data.data.message) {
        if (cb_fail === true) {
          console.warn(data.data.message);
        } else if (Object.prototype.toString.call(cb_fail) === '[object Function]') {
          cb_fail(data)
        }
      }
    },
    cons(data) {
       return data
    }
  }
};

export default mixin;
